import Taro from '@tarojs/taro-rn';
import * as tslib_1 from "tslib";
import React from 'react';
import { Component } from "@tarojs/taro-rn";
import { View, Image, Text } from "@tarojs/components-rn";
import { inject, observer } from "@tarojs/mobx-rn";
import { getRuntime, subtime } from "../../utils/common";
import page3_detailStyleSheet from "./page3_detail_styles";

import icon_96 from '../../assets/img/icon_96.png';
import icon_97 from '../../assets/img/icon_97.png';
import icon_98 from '../../assets/img/icon_98.png';
import icon_99 from '../../assets/img/icon_99.png';
import Report from "../../components/Report";
import PageFooterInfo from "../../components/PageFooterInfo";
var _styleSheet = page3_detailStyleSheet;
let Page3_detail = class Page3_detail extends Component {
  constructor(props) {
    super(props);
    this.state = {
      allProvince: [],
      info: {},
      iconType: icon_96
    };
  }
  componentWillMount() {
    Taro.setNavigationBarTitle({ title: '资质转让详情' });
    let id = this.$router.params.id;
    if (id) {
      this.getQualificationServiceCenterInfo(parseInt(id));
    }
  }
  getAllProvince() {
    let { AreaStore } = this.props.stores;
    AreaStore.getAllProvinceFromLocal({
      callBack: res => {
        //console.log(res)
        this.setState({
          allProvince: res
        });
      }
    });
  }
  getQualificationServiceCenterInfo(formId) {
    let { FinancialCenterStore } = this.props.stores;
    FinancialCenterStore.getQualificationServiceCenterInfo({
      formId,
      callback: res => {
        let iconType = icon_96;
        switch (parseInt(res.qualificationsType)) {
          case 1:
            {
              iconType = icon_96;
              break;
            }
          case 2:
            {
              iconType = icon_97;
              break;
            }
          case 3:
            {
              iconType = icon_98;
              break;
            }
          case 4:
            {
              iconType = icon_99;
              break;
            }
          default:
            {
              iconType = icon_99;
            }
        }
        this.setState({
          iconType,
          info: res
        });
      }
    });
  }
  handelRouter(url = '/pages/index/index') {
    getRuntime().navigateTo(url);
  }
  getAreaTextByAreaCode(areaCode) {
    let { allProvince } = this.state;
    allProvince.map(item => {
      if (item.value === areaCode) {
        return item.label;
      } else {
        return areaCode;
      }
    });
  }
  makePhone(phone) {
    if (!phone) {
      getRuntime().showToast('用户未提交联系方式~');
    }
    getRuntime().makePhoneCall(phone);
  }
  render() {
    let { info, iconType } = this.state;
    return <View style={_styleSheet["business-detail"]}>
       <View style={_styleSheet["list-04-item"]}>
         <View style={_styleSheet["top"]}>
           <View style={_styleSheet["l"]}>
             <View style={_styleSheet["title"]}>{info.title}</View>
             <View style={_styleSheet["price"]}>{info.priceInterval}<Text style={_styleSheet["list-small"]}>万</Text> </View>
           </View>
           <Image src={iconType} style={_styleSheet["icon"]} />
         </View>
         <View style={_styleSheet["info"]}>
           <Text style={_styleSheet["date"]}>发布：{subtime(info.creationTime)}</Text>
           <Text style={_styleSheet["date"]}>浏览：{info.numberOfVisits}人</Text>
         </View>
       </View>
       <View style={_styleSheet["interval"]} />

       <View style={[_styleSheet["column-title"], _styleSheet["content-30"]]}>
         <Text style={_styleSheet["column-name"]}>基本信息</Text>
       </View>
       <View style={_styleSheet["item-lawyer"]}>
         <View style={_styleSheet["line"]}>
           <Text style={_styleSheet["title"]}>资质级别：</Text>
           <Text style={_styleSheet["name"]}>{info.qualificationLevel}</Text>
         </View>
         <View style={_styleSheet["line"]}>
           <Text style={_styleSheet["title"]}>纳税类型：</Text>
           <Text style={_styleSheet["name"]}>{info.taxpayerType}</Text>
         </View>
         <View style={_styleSheet["line"]}>
           <Text style={_styleSheet["title"]}>所在地区：</Text>
           <Text style={_styleSheet["name"]}>{info.contactsArea}</Text>
         </View>
         <View style={_styleSheet["line"]}>
           <Text style={_styleSheet["title"]}>价格区间：</Text>
           <View style={_styleSheet["name"]}>
             <Text>{info.priceInterval}万</Text>
           </View>
         </View>
       </View>
       <View style={_styleSheet["interval"]} />

       <View style={[_styleSheet["column-title"], _styleSheet["content-30"]]}>
         <Text style={_styleSheet["column-name"]}>备注</Text>
       </View>
       <View style={_styleSheet["item-lawyer-desc"]}>
         {info.remarks}
       </View>
       <View style={_styleSheet["interval"]} />

       <View style={[_styleSheet["column-title"], _styleSheet["content-30"]]}>
         <Text style={_styleSheet["column-name"]}>联系方式</Text>
       </View>
       <View style={_styleSheet["item-lawyer"]}>
         <View style={_styleSheet["line"]}>
           <Text style={_styleSheet["title"]}>联系人：</Text>
           <Text style={_styleSheet["name"]}>{info.contactsName}</Text>
         </View>
         <View style={_styleSheet["line"]}>
           <Text style={_styleSheet["title"]}>联系电话：</Text>
           <Text style={_styleSheet["name"]}>{info.contactsPhone}</Text>
         </View>
         <View style={_styleSheet["line"]}>
           <Text style={_styleSheet["title"]}>微信号：</Text>
           <Text style={_styleSheet["name"]}>{info.contactsWechat}</Text>
         </View>
         <View style={_styleSheet["line"]}>
           <Text style={_styleSheet["title"]}>QQ号：</Text>
           <Text style={_styleSheet["name"]}>{info.contactsQQ}</Text>
         </View>
       </View>
       <View style={_styleSheet["interval"]} />

      <Report />
       <PageFooterInfo />
       <View style={_styleSheet["footer-block"]} />
      <View onClick={this.makePhone.bind(this, info.contactsPhone)} style={_styleSheet["page-submit"]}>立即电话咨询</View>

     </View>;
  }
};
Page3_detail = tslib_1.__decorate([inject("stores"), observer], Page3_detail);
export default Page3_detail;